from django.conf.urls.defaults import *
from eport.blog import views
from eport.blog.models import Post, Comment
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap

info_dict_map = {
	'queryset' : Post.objects.all(),
	'date_field' : 'creation_date'
}
sitemaps = {
	"blog" : GenericSitemap(info_dict_map, priority=0.5),
}
info_dict_year = {
    'queryset': Post.objects.all(),
    'date_field': 'creation_date',
	'template_name' : 'blog/view_timestamp.html',
	'make_object_list' : True,
	'allow_empty' : True,
}
info_dict_month = {
    'queryset': Post.objects.all(),
    'date_field': 'creation_date',
	'template_name' : 'blog/view_timestamp.html',
	'month_format' : '%m',
	'allow_empty' : True,
}
info_dict_day = {
    'queryset': Post.objects.all(),
    'date_field': 'creation_date',
	'template_name' : 'blog/view_timestamp.html',
	'month_format' : '%m',
	'allow_empty' : True,
}
urlpatterns = patterns('',
	(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
	(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\w{1,2})/(?P<post_id>\d)/$', views.view_post),
	(r'^(?P<year>\d{4})/$', 'django.views.generic.date_based.archive_year', info_dict_year),
	(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/$', 'django.views.generic.date_based.archive_month', info_dict_month),
	(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\w{1,2})/$', 'django.views.generic.date_based.archive_day', info_dict_day),
	(r'^comments/add/(?P<post_id>[^/]+)/$', views.add_comment),
	(r'^comments/(?P<post_id>[^/]+)/delete/(?P<comment_id>[^/]+)/$', views.remove_comment),
	(r'^$', views.index),
)
